package cn.lzx.transaction.inter.impl;

import cn.lzx.domain.Producer;
import cn.lzx.domain.ProducerJpaRepository;
import cn.lzx.transaction.inter.ProducerServiceInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by lizhenxing on 2017/8/31.
 */
@Service
public class ProducerServiceInterImpl implements ProducerServiceInter {

    @Autowired
    private ProducerJpaRepository producerJpaRepository;


    public void outBuy(Long userId,Long gain) throws Exception {
        Producer producer = producerJpaRepository.findOne(userId);
        long money = producer.getMoney() + gain;
        producer.setMoney(money);
        producerJpaRepository.save(producer);
        throw new Exception();
    }
}
